#pragma once


void ClearDrawRepetition(SEngineData *ed);

// draw stack evalaution functions
void DrawPushMove(SEngineData *ed, ZOBRIST_KEY zkeyBoard);
void DrawPopMove(SEngineData *ed, ZOBRIST_KEY zkeyBoard);

// for adding the game history to the draw eval stack
template<typename BB> void PushMoveHistory(SEngineData *ed, BB* bbList, int count, bool bFirstWhite);

// checks the draw repetition
bool IsDrawByRepetition(SEngineData *ed, ZOBRIST_KEY zkeyBoard);

// wrapper templates for calling draw evaluation function
template<typename BB> bool  IsDraw(SEngineData *ed, BB* bb, ZOBRIST_KEY zkeyBoard);
template<> bool IsDraw<BitBoard>(SEngineData *ed, BitBoard* bb, ZOBRIST_KEY zkeyBoard);
template<> bool IsDraw<BitBoard64>(SEngineData *ed, BitBoard64* bb, ZOBRIST_KEY zkeyBoard);

// for adding the game history to the draw eval stack
template<typename BB> void PushMoveHistory(SEngineData *ed, BB* bbList, int count, bool bFirstWhite)
{
	bool bWhite = bFirstWhite;
	for(int i = 0; i < count; i++)
	{
		ZOBRIST_KEY zkeyBoard = GenerateZobristHash<BB>(bbList + i, bWhite);
		DrawPushMove(ed, zkeyBoard);
		bWhite = ! bWhite;
	}
}

// sets the draw evaluation function for given checkers type
void SetCheckersTypeDraw(SEngineData *ed, eCheckersType type);
